package com.wondersgroup.fjzlpt.plat.controller.view;

import com.alibaba.fastjson.JSONObject;
import com.quick.framework.boot.web.utils.RequestUtils;
import com.quick.framework.util.QuickPrincipalUtils;
import com.wondersgroup.fjzlpt.plat.service.inter.PwdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * 修改密码
 * Created by lion on 2017/8/25.
 */
@Controller
public class UpdatePasswordController {

    @Autowired
    PwdService iPwdService;

    /**
     * 跳转修改密码页面
     * @param request
     * @return
     */
    @RequestMapping("/ignore/updatePwd.html")
    public String updatePwd(HttpServletRequest request){
        return "updatePwd/updatePwd";
    }

    /**
     * 保存密码
     * @param request
     * @return
     */
    @RequestMapping("/savePwd")
    @ResponseBody
    public JSONObject savePwd(HttpServletRequest request){
        String USERID = QuickPrincipalUtils.getUserID(request);
        Map map = RequestUtils.GetParameterMap(request);
        map.put("USERID", USERID);
        return iPwdService.updatePwd(map);
    }
}












